package com.micro.common;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020/8/3
 */
public class MicroConstant {

    /**
     * <h2>云存储服务商类型</h2>
     */
    public static class CloudStorageServiceProvider{

        /**
         * 阿里云存储
         */
        public static final String OSS_SERVICE_PROVIDER_ALIYUN = "ali-cloud";

        /**
         * 七牛云存储
         */
        public static final String OSS_SERVICE_PROVIDER_QINIUYUN = "qiniu-cloud";

        /**
         * 腾讯云存储
         */
        public static final String OSS_SERVICE_PROVIDER_QCLOUD = "tencent-cloud";
    }

    /**
     * <h2>临时存储在ThreadLocal中信息</h2>
     */
    public static class ThreadLocalContext{
        /**
         * 客户主键id
         */
        public static final String CONTEXT_KEY_CUSTOMER_ID = "currentCustomerId";

        /**
         * 客户编号
         */
        public static final String CONTEXT_KEY_CUSTOMER_CODE = "currentCustomerCode";

        /**
         * 客户类型
         */
        public static final String CONTEXT_KEY_CUSTOMER_TYPE = "currentCustomerType";

        /**
         * 临时存在ThreadLocal中的 登录名 key
         */
        public static final String CONTEXT_KEY_CUSTOMER_NAME = "currentCustomerName";

        /**
         * 临时存在ThreadLocal中的 服务名 key
         */
        public static final String CONTEXT_KEY_SERVER_NAME = "currentServerName";


        /**
         * 临时存在ThreadLocal中的 渠道 key
         */
        public static final String CONTEXT_KEY_CHANNEL_NAME = "currentServerName";

        /** 临时存在ThreadLocal中的 appId key */
        public static final String CONTEXT_KEY_APP_ID = "currentAppId";

        /** 临时存在ThreadLocal中的 昵称 key */
        public static final String CONTEXT_KEY_NAME = "currentName";

        /** 临时存在ThreadLocal中的 token key */
        public static final String CONTEXT_KEY_APP_TOKEN = "currentAppToken";
    }

    /**
     * 系统默认值
     */
    public static class SystemDefaultValue{

        /**
         * 菜单树默认父级编号
         */
        public static final String DEFAULT_PARENT_CODE = "0";

        /**
         * 默认起始数值
         */
        public static final Integer DEFAULT_START_COUNT = 0;

        /**
         * 默认方法类型 GET
         */
        public static final String DEFAULT_METHOD = "GET";

        /**
         * 默认操作方法:访问
         */
        public static final String DEFAULT_OPERATION_NAME = "访问";

        /**
         * 默认头像
         */
        public static final String DEFAULT_AVATAR = "";

        /**
         * 默认密码
         */
        public static final String DEAFULT_PASSWORD = "123456";

        /**
         * 默认系统编号
         */
        public static final String DEFAULT_SYSTEM_CODE = "系统发布";

    }


    /**
     * 执行状态
     */
    public static class StatusExecution{

        /**
         * 未开始
         */
        public static final Byte NOT_STARTED = 1;

        /**
         * 进行中
         */
        public static final Byte IN_PROGRESS = 2;

        /**
         * 已结束
         */
        public static final Byte FINISHED = 3;

    }


    /**
     * 请求渠道 channelType
     */
    public static class ChannelType{

        /**
         * ios
         */
        public static final String MICRO_IOS = "micro-ios";

        /**
         * android
         */
        public static final String MICRO_ANDROID = "micro-android";

        /**
         * web
         */
        public static final String MICRO_WEB = "micro-web";

        /**
         * admin
         */
        public static final String MICRO_ADMIN = "micro-admin";

        /**
         * m 站 /H5 公众号
         */
        public static final String MICRO_M = "micro-wap";

        /**
         *
         */
        public static final List channelTypeList = Lists.newArrayList(MICRO_IOS,MICRO_ANDROID,MICRO_WEB,MICRO_ADMIN,MICRO_M);
    }


    /**
     * redis key 前缀定义
     */
    public static class RedisKeyPrefix{

        /**
         * 优惠券码 key 前缀
         */
        public static final String COUPON_TEMPLATE_CODE = "coupon_template_code_";

        /**
         * 用户当前所有可用优惠券 key 前缀
         */
        public static final String USER_COUPON_USABLE = "user_coupon_usable_";

        /**
         * 用户当前所有已使用的优惠券 key 前缀
         */
        public static final String USER_COUPON_USED = "user_coupon_used_";

        /**
         * 用户当前所有已过期的优惠券 key 前缀
         */
        public static final String USER_COUPON_EXPIRED = "user_coupon_expired_";

        /**
         *  用户私钥
         */
        public static final String REDIS_USER_PRI_KEY = "MICRO:AUTH:JWT:PRI";

        /**
         *  用户公钥
         */
        public static final String REDIS_USER_PUB_KEY = "MICRO:AUTH:JWT:PUB";

        /**
         *  服务私钥
         */
        public static final String REDIS_SERVICE_PRI_KEY = "MICRO:AUTH:CLIENT:PRI";

        /**
         *  服务公钥
         */
        public static final String REDIS_SERVICE_PUB_KEY = "MICRO:AUTH:CLIENT:PUB";

    }

    /**
     * <h2>jwt 相关参数</h2>
     */
    public static class Jwt{

        /**
         * <p>客户编号 JWT_KEY_CUSTOMER_COED </p>
         */
        public static final String JWT_KEY_CUSTOMER_COED = "customerCode";

        /**
         * <p>服务名称 JWT_KEY_SERVER_NAME</p>
         */
        public static final String JWT_KEY_SERVER_NAME = "serverName";

        /**
         * <p>客户名称 JWT_KEY_CUSTOMER_NAME</p>
         */
        public static final String JWT_KEY_CUSTOMER_NAME = "customerName";

        /**
         * <p>客户类型类型 JWT_KEY_CUSTOMER_TYPE</p>
         */
        public static final String JWT_KEY_CUSTOMER_TYPE = "customerType";

        /**
         * <p>请求API版本信息 JWT_KEY_SERVER_VERSION</p>
         */
        public static final String JWT_KEY_SERVER_VERSION = "serverVersion";

        /**
         * <p>请求渠道类型 JWT_KEY_CHANNEL_TYPE</p>
         * <p> 安卓:android ,苹果:ios ,web:web client:applet client:official client:h5</p>
         */
        public static final String JWT_KEY_CHANNEL_TYPE = "channelType";

    }

    /**
     * 异步服务 枚举编号
     */
    public static class AsyncRuleTypeCode{

        /**
         * 优惠券编号异步服务
         */
        public static final String ASYNC_COUPON_CODE = "001";

        /**
         * 默认用户信息异步服务
         */
        public static final String ASYNC_DEFAULT_USER_INFO = "002";

        /**
         * 移除商品sku异步服务
         */
        public static final String ASYNC_REMOVE_GOODS_SKU = "003";
    }

    /**
     * 状态有效性
     */
    public static class StatusEffective{

        /**
         * 有效
         */
        public static final Byte ENABLE = 1;

        /**
         * 无效
         */
        public static final Byte DISABLE = 2;

        /**
         * 锁定
         */
        public static final Byte LOCKED = 3;
    }

    /**
     * 授权类型
     */
    public static class AuthType{

        /**
         * 手机号
         */
        public static final String AUTH_PHONE = "phone";

        /**
         * 邮箱
         */
        public static final String AUTH_EMAIL = "email";

        /**
         * 用户名
         */
        public static final String AUTH_USER_NAME = "username";

        /**
         * 微信
         */
        public static final String AUTH_WECHAT = "wechat";

        /**
         * QQ
         */
        public static final String AUTH_QQ = "QQ";

        /**
         * 微博
         */
        public static final String AURH_WEI_BO = "weibo";

        /**
         * 第三方授权类型
         */
        public static final List thirdAuthList = Lists.newArrayList(AUTH_WECHAT,AUTH_QQ,AURH_WEI_BO);
    }

    /**
     * 客户类型
     */
    public static class CustomerType{

        /**
         * 系统用户
         */
        public static final String SYSTEM_USER_TYPE = "system-user";

        /**
         * 普通用户/会员用户/
         */
        public static final String MEMBER_USER_TYPE = "member-user";
    }


    /**
     * 登陆类型
     */
    public static class LoginType{

        /**
         * 账号密码登录
         */
        public static final String ORDINARY_LOGIN = "01";

        /**
         * 第三方登录
         */
        public static final String OPEN_LOGIN = "02";

        /**
         * 手机号快捷登录
         */
        public static final String QUICK_LOGIN = "03";

    }

    /**
     * 账户类型
     */
    public static class AccountType{

        /**
         * 余额账户
         */
        public static final String ACCOUNT_BALANCE = "balance";

        /**
         * 积分账户
         */
        public static final String INTEGRAL_ACCOUNT = "integral";
    }
}
